package cxm.proj.sms;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Point;
import android.os.Bundle;
import android.os.Handler;
import android.view.Display;
import android.widget.TextView;

public class Homepage extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_homepage);
        
        int width = 0;
        int height = 0;
        Display display = getWindowManager().getDefaultDisplay(); 
        if (Integer.valueOf(android.os.Build.VERSION.SDK_INT) < 13)
        {
            width = display.getWidth();
            height = display.getHeight();
        }
        else
        {
        	Point size = new Point();
        	height = size.y;
            // display.getSize(size);
            width = size.x;
            // for test
            width = display.getWidth();
            height = display.getHeight();
        }
        
        // set screen resolution
        TextView aText = (TextView)findViewById(R.id.aText);
        aText.setText("Resolution: " + width + " * " + height);
        
        // post delay to load main activity
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                final Intent mainIntent = new Intent(Homepage.this, MainActivity.class);
                Homepage.this.startActivity(mainIntent);
                Homepage.this.finish(); // finish self to exit back stack
            }
        }, 2500);
    }

/*
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.homepage, menu);
        return true;
    }
*/
}
